package com.cssy.xxkj.logic.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.cssy.xxkj.logic.dao.LogicMaterialBackItemDAO;
import com.cssy.xxkj.logic.entity.LogicMaterialBackItemDO;

/**
 * 数据访问对象实现类
 * @since 2014-12-31
 */
public class LogicMaterialBackItemDAOImpl extends SqlMapClientDaoSupport implements LogicMaterialBackItemDAO {

    /**
     * 插入数据
     * @param logicMaterialBackItemDO
     * @return 插入数据的主键
     */
    public String insertLogicMaterialBackItemDO(LogicMaterialBackItemDO logicMaterialBackItemDO) throws DataAccessException {
        Object id = getSqlMapClientTemplate().insert("LogicMaterialBackItem.insert", logicMaterialBackItemDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param logicMaterialBackItemDO
     * @return 查出的记录数
     */
    public Integer countLogicMaterialBackItemDOByExample(LogicMaterialBackItemDO logicMaterialBackItemDO) throws DataAccessException {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicMaterialBackItem.countByDOExample", logicMaterialBackItemDO);
        return count;
    }

    /**
     * 更新记录
     * @param logicMaterialBackItemDO
     * @return 受影响的行数
     */
    public Integer updateLogicMaterialBackItemDO(LogicMaterialBackItemDO logicMaterialBackItemDO) throws DataAccessException {
        int result = getSqlMapClientTemplate().update("LogicMaterialBackItem.update", logicMaterialBackItemDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param logicMaterialBackItemDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicMaterialBackItemDO> findListByExample(LogicMaterialBackItemDO logicMaterialBackItemDO) throws DataAccessException {
        List<LogicMaterialBackItemDO> list = getSqlMapClientTemplate().queryForList("LogicMaterialBackItem.findListByDO", logicMaterialBackItemDO);
        return list;
    }
    
    public List<LogicMaterialBackItemDO> findListByMap(Map<String, Object> paramMap) throws DataAccessException {
        List<LogicMaterialBackItemDO> list = getSqlMapClientTemplate().queryForList("LogicMaterialBackItem_ex.findListByMap", paramMap);
        return list;
    }
    

    /**
     * 根据主键获取logicMaterialBackItemDO
     * @param id
     * @return logicMaterialBackItemDO
     */
    public LogicMaterialBackItemDO findLogicMaterialBackItemDOByPrimaryKey(String id) throws DataAccessException {
        LogicMaterialBackItemDO logicMaterialBackItemDO = (LogicMaterialBackItemDO) getSqlMapClientTemplate().queryForObject("LogicMaterialBackItem.findByPrimaryKey", id);
        return logicMaterialBackItemDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteLogicMaterialBackItemDOByPrimaryKey(String id) throws DataAccessException {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicMaterialBackItem.deleteByPrimaryKey", id);
        return rows;
    }

}